package com.ejuornal.action.interceptor;

import java.util.Map;

import com.ejuornal.util.Constants;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
/**
 * 项目名称：ejuornal    
 * 类名称：AdminPrivilege_1    
 * 类描述：  会员管理员权限拦截器  
 * 创建人：Administrator    
 * 创建时间：Apr 28, 2013 6:54:12 PM    
 * 修改人：Administrator    
 * 修改时间：Apr 28, 2013 6:54:12 PM    
 * 修改备注：    
 * @version     
 *
 */
public class AdminPrivilege_8 implements Interceptor{
    private static final long serialVersionUID = -3449833539899776410L;

    @Override
    public void destroy() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void init() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public String intercept(ActionInvocation invocation) throws Exception {
        ActionContext context = invocation.getInvocationContext();
        Map<String, Object> session = context.getSession();
        String roleId = (String) session.get(Constants.ADMINSESSIONROLEID);
        if(roleId == null || "".equals(roleId)) {
            return "error_adminLogin";
        } else if(roleId.equals("8") || roleId.equals("7")) {
            return invocation.invoke();
        } else {
            return "error_403";
        }
    }

}
